package com.zzx.test.future;

import org.junit.Test;

import java.nio.charset.StandardCharsets;
import java.security.*;
import java.util.Base64;

public class FifteenClass1 {

    @Test
    public void passwordEncrypt() {
        try {
            KeyPairGenerator kpg = KeyPairGenerator.getInstance("Ed25519");
            KeyPair kp = kpg.generateKeyPair();
            byte[] msg = "www.wdbyte.com".getBytes(StandardCharsets.UTF_8);
            Signature sig = Signature.getInstance("Ed25519");
            sig.initSign(kp.getPrivate());
            sig.update(msg);
            byte[] s = sig.sign();
            System.out.println(Base64.getEncoder().encodeToString(s));
        } catch (NoSuchAlgorithmException | InvalidKeyException | SignatureException e) {
            throw new RuntimeException(e);
        }
    }

    @Test
    public void textArea() {
        String content = """
                {
                    "upperSummary": null,
                    "sensitiveTypeList": null,
                    "gmtModified": "2011-08-05\s10:50:09",
                }
                 """;
        System.out.println(content);

    }


}
